package com.telit.firecommand.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;


/**
 * @Author:zhangwei
 * @Description:
 * @Time:Created on 2021/8/3 8:43
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "CommEmergencyPlan", description = "应急预案表")
public class CommEmergencyPlan implements Serializable {

    /**
     * 主键id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 预案名称
     */
    @NotNull(message = "预案名称不能为空")
    @ApiModelProperty(value = "预案名称")
    private String planName;

    /**
     * 文件编号
     */
//    @NotNull(message = "文件编号不能为空")
    @ApiModelProperty(value = "文件编号")
    private String fileCode;

    /**
     * 发布机构
     */
//    @NotNull(message = "发布机构不能为空")
    @ApiModelProperty(value = "发布机构")
    private String releaseAgency;

    /**
     * 发布时间
     */
    @NotNull(message = "发布时间不能为空")
    @ApiModelProperty(value = "发布时间")
    private String releaseDate;

    /**
     * 预案文件
     */
    @ApiModelProperty(value = "预案文件")
    private String imageUrl;

    /**
     * 创建人
     */
    private String createUser;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Date updateTime;

    /**
     * 更新人
     */
    private String updateUser;

    /**
     * 是否删除，0是正常，1是删除
     */
    @ApiModelProperty(value = "是否删除,1是删除")
    @TableLogic(value = "0", delval = "1")
    private String deleted;

    /**
     * 文件预览地址
     */
    @ApiModelProperty(value = "文件预览地址")
    @TableField(exist = false)
    private String previewUrl;

    @ApiModelProperty(value = "应急预案类型")
    private String planType;

    @ApiModelProperty(value = "应急预案版本")
    private String planVersion;

    @ApiModelProperty(value = "应急预案来源")
    private String planSource;

    @ApiModelProperty(value = "应急预案要素--等级")
    private String planLevel;

    @ApiModelProperty(value = "应急预案伤亡人数开始")
    private Integer planPeopleStart;

    @ApiModelProperty(value = "应急预案伤亡人数结束")
    private Integer planPeopleEnd;

    @ApiModelProperty(value = "应急预案火灾面积开始")
    private BigDecimal planFireAreaStart;

    @ApiModelProperty(value = "应急预案火灾面积结束")
    private BigDecimal planFireAreaEnd;

    @ApiModelProperty(value = "匹配程度")
    @TableField(exist = false)
    private BigDecimal ratio;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CommEmergencyPlan that = (CommEmergencyPlan) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    private static final long serialVersionUID = 1L;

}
